-
Notifications
You must be signed in to change notification settings - Fork 152
[TRAFODION-3190] expression involving NULL should be treated as FALSE, not TRUE. #1741
base: master
Are you sure you want to change the base?
Conversation
Can one of the admins verify this patch? |
Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/3027/ |
Can one of the admins verify this patch? |
1 similar comment
Can one of the admins verify this patch? |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/3027/ |
New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/3035/ |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/3035/ |
c1b3e25
to
c64986d
Compare
New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/3036/ |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/3036/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 I don't believe this fix is correct. See comments inline.
@@ -96,7 +96,7 @@ ex_expr::exp_return_type ex_branch_clause::eval(char *op_data[], | |||
switch (getOperType()) | |||
{ | |||
case ITM_AND: | |||
if (*(Lng32 *)op_data[1] == 0) | |||
if (*(Lng32 *)op_data[1] == 0 || *(Lng32 *)op_data[1] == -1) // null treated as false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe this is correct. Consider the query, "select a from t1x where not(b = 0 and c = 0)". When B and C are both null, both equal predicates evaluate to null, and the AND evaluates to null. The NOT then also evaluates to null. The WHERE clause should treat the result of the NOT as false. But with this fix, the result of the AND will be false, making the NOT true. There needs to be three cases here for ITM_AND: If the first operand is false, then the AND is false. If the first operand is true, then the result is the second operand. If the first operand is null, then if the second operand is false, the result is false otherwise the result is null. Similar logic needs to be added to the ITM_OR case.
Dave is correct. Thanks for pointing it out. Branch clause need to evaluate the second leg if the first leg is 'not false' which means Similar comments were added to an earlier PR 1705 for this same jira For the original issue where CASE WHEN stmt was not proceeding to ELSE leg, a change |
No description provided.